home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Objects / ScreenObject.s < prev    next >
Encoding:
Text File  |  1998-10-04  |  4.6 KB  |  174 lines

  1. ;-------T-------T------------------------T---------------------------------;
  2. ;This demo will open a screen, based on the parameters in an external object
  3. ;file.  This allows a VERY high level of external editing that will alter
  4. ;how this program behaves, without having to reassemble it.
  5. ;
  6. ;This feature is highly important as it allows up to 100% configurability of
  7. ;your game, which previously has only been available to applications using
  8. ;libraries such as MUI.  However, it is even more powerful than this as
  9. ;graphic artists could not only create new datasets for your game, but also
  10. ;alter the dimensions, colours, resolution, attributes (and more) of your
  11. ;Bobs and Screens.  Support for code segments is also available, so
  12. ;external functions could be altered and improved by programmers.  This will
  13. ;ensure that your game has a long lasting future as it keeps up with current
  14. ;technology and additions to GMS.
  15. ;
  16. ;I hope you make the most of external objects, its worth it!
  17.  
  18.     INCDIR    "GMSDev:Includes/"
  19.     INCLUDE    "dpkernel/dpkernel.i"
  20.     INCLUDE    "files/objects.i"
  21.     INCLUDE    "modules/objects.i"
  22.  
  23.     SECTION    "Objects",CODE
  24.  
  25. ;===========================================================================;
  26. ;                             INITIALISE DEMO
  27. ;===========================================================================;
  28.  
  29.     STARTDPK
  30.  
  31. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  32.     move.l    DPKBase(pc),a6
  33.     lea    OBJFileName(pc),a0
  34.     moveq    #ID_OBJECTFILE,d0
  35.     CALL    Load
  36.     move.l    d0,ObjectBase
  37.     beq    .Exit
  38.  
  39.     ;Open the objects module.
  40.  
  41.     lea    ObjModTags(pc),a0    ;a0 = Module tags.
  42.     sub.l    a1,a1    ;a1 = No container.
  43.     CALL    Init    ;>> = Initialise Cards Interface.
  44.     tst.l    d0    ;d0 = Check for error.
  45.     beq    .Exit    ;>> = Error, exit.
  46.     move.l    d0,a0    ;a0 = Card module.
  47.     move.l    MOD_ModBase(a0),OBJBase    ;ma = Store jump table.
  48.  
  49.     ;Load the file, then start
  50.     ;getting our objects.
  51.  
  52.     move.l    OBJBase(pc),a6
  53.     move.l    ObjectBase(pc),a0    ;a0 = Object Base.
  54.     lea    TXT_ScreenName(pc),a1    ;a1 = The name of the object to get.
  55.     CALL    PullObject    ;>> = Get our GameScreen object.
  56.     move.l    d0,Screen    ;a0 = Screen tags of our object.
  57.     beq    .Exit    ;>> = Quit if error.
  58.  
  59.     move.l    OBJBase(pc),a6
  60.     move.l    ObjectBase(pc),a0    ;a0 = Object Base.
  61.     lea    TXT_PictureName(pc),a1    ;a1 = The name of the object to get.
  62.     CALL    PullObject    ;>> = Get our GameScreen object.
  63.     move.l    d0,Picture    ;>> = Picture tags of our object.
  64.     beq.s    .Exit    ;>> = Quit if error.
  65.  
  66.     ;Initialise the screen.
  67.  
  68.     move.l    DPKBase(pc),a6
  69.     move.l    Screen(pc),a0    ;a0 = Screen tags
  70.     sub.l    a1,a1
  71.     CALL    Init    ;>> = Initialise the screen.
  72.     tst.l    d0    ;ma = Save pointer to the GameScreen.
  73.     beq.s    .Exit    ;>> = Quit if error.
  74.  
  75.     ;Initialise the picture.
  76.  
  77.     move.l    Picture(pc),a0
  78.     move.l    Screen(pc),a1
  79.     move.l    PIC_Bitmap(a0),a2
  80.     move.l    GS_MemPtr1(a1),BMP_Data(a2)
  81.     sub.l    a1,a1
  82.     CALL    Init
  83.     tst.l    d0
  84.     beq.s    .Exit
  85.  
  86.     move.l    SCRBase(pc),a6
  87.     move.l    Screen(pc),a0
  88.     move.l    Picture(pc),a1
  89.     move.l    GS_Bitmap(a0),a2
  90.     move.l    PIC_Bitmap(a1),a1
  91.     move.l    BMP_Palette(a1),BMP_Palette(a2)
  92.     CALL    scrUpdatePalette
  93.  
  94.     move.l    DPKBase(pc),a6
  95.     moveq    #ID_JOYDATA,d0    ;Get joydata structure for reading
  96.     CALL    Get    ;port 0.
  97.     move.l    d0,JoyData
  98.     beq.s    .Exit
  99.     move.l    d0,a0    ;Initialise the joydata structure.
  100.     sub.l    a1,a1
  101.     CALL    Init
  102.     tst.l    d0
  103.     beq.s    .Exit
  104.  
  105.     move.l    Screen(pc),a0
  106.     CALL    Display
  107.  
  108.     bsr.s    Main
  109.  
  110. .Exit    move.l    DPKBase(pc),a6
  111.     move.l    JoyData(pc),a0
  112.     CALL    Free
  113.     move.l    Picture(pc),a0
  114.     CALL    Free
  115.     move.l    Screen(pc),a0
  116.     CALL    Free
  117.     move.l    ObjectBase(pc),a0
  118.     CALL    Free
  119.     move.l    ObjModule(pc),a0
  120.     CALL    Free
  121.     MOVEM.L    (SP)+,A0-A6/D1-D7
  122.     moveq    #ERR_OK,d0
  123.     rts
  124.  
  125. ;===========================================================================;
  126. ;                                MAIN LOOP
  127. ;===========================================================================;
  128.  
  129. Main:    move.l    SCRBase(pc),a6
  130.     CALL    scrWaitAVBL
  131.  
  132.     move.l    DPKBase(pc),a6
  133.     move.l    JoyData(pc),a0
  134.     CALL    Query
  135.     move.l    JoyData(pc),a0
  136.     move.l    JD_Buttons(a0),d0
  137.     btst    #JB_LMB,d0
  138.     beq.s    Main
  139.     rts
  140.  
  141. ;===========================================================================;
  142. ;                                  DATA
  143. ;===========================================================================;
  144.  
  145. Screen:        dc.l  0
  146. Picture:    dc.l  0
  147. JoyData:    dc.l  0
  148. ObjectBase:    dc.l  0
  149. OBJBase:    dc.l  0
  150. OBJFileName:    FILENAME "GMS:demos/data/Screen.obj"
  151.  
  152. TXT_ScreenName:    dc.b  "Screen",0
  153.         even
  154. TXT_PictureName    dc.b  "Picture",0
  155.         even
  156.  
  157. ObjModTags:    dc.l  TAGS_MODULE
  158. ObjModule:    dc.l  0
  159.         dc.l  MODA_Name,ObjName
  160.         dc.l  TAGEND
  161.  
  162. ObjName:    dc.b  "objects.mod",0
  163.         even
  164.  
  165. ;===========================================================================;
  166.  
  167. ProgName:    dc.b  "Screen Object",0
  168. ProgAuthor:    dc.b  "Paul Manias",0
  169. ProgDate:    dc.b  "February 1998",0
  170. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1998.  Freely distributable.",0
  171. ProgShort:    dc.b  "Screen Object demonstration.",0
  172.         even
  173.  
  174.